<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
			button {
				background-color: blue;
				color: white;
				width: 80px;
			}
		</style>
		<script>
			function find(id) {
				// var img = document.getElementById("img");
				// var wd = document.getElementsByName("wd");
				var f = document.getElementById("f2");
				var actArr = ["https://www.baidu.com/s?", "https://www.google.com.hk", "https://www.taobao.com"];
				var imgArr = ["../day8/img/baidu_web.png", "../day8/img/google_web.png",
					"../day8/img/taobao_shopping.png"];
					var nameArr = ["wd", "wd", "wd"];
					var index = 0;
					img.src = imgArr[index];
					img.action = actArr[index];
					if (id == 'baidu') {
						f.action = actArr[0];
						f.children[0].src = imgArr[0];
						f.children[1].name = nameArr[0];
					} else if (id == 'guge') {
						f.action = actArr[1];
						f.children[0].src = imgArr[1];
						f.children[1].name = nameArr[1];
					} else if (id == 'taobao') {
						f.action = actArr[2];
						f.children[0].src = imgArr[2];
						f.children[1].name = nameArr[2];
					} 

				}
		</script>
	</head>
	<body>
		<div>
			<form id="f2" action="https://www.baidu.com/s?" >
				<img src="../day8/img/baidu_web.png" id="img" />
				<input type="text" name="wd" />
				<button>搜索</button>
				<br />
				<input type="radio" name="adc" onclick="find('baidu')" />百度
				<input type="radio" name="adc"  onclick="find('guge')" />谷歌
				<input type="radio" name="adc"  onclick="find('taobao')" />淘宝
			</form>
		</div>
	</body>
</html>
